<template>
  <!-- 无图 -->
  <!-- <div class="article-item van-hairline--bottom">
    <p class="title van-multi-ellipsis--l2">美国强行关闭33家伊朗网站 伊总统办公室警告：不利于伊核谈判</p>
    <div class="info">
      <span>小兵张嘎</span>
      <span>17评论</span>
      <span>1天前</span>
      <geek-icon name="esay-close"></geek-icon>
    </div>
  </div> -->
  <!-- 三图 -->
  <!-- <div class="article-item van-hairline--bottom">
    <p class="title van-multi-ellipsis--l2">美国强行关闭33家伊朗网站 伊总统办公室警告：不利于伊核谈判</p>
    <img class="img" src="https://inews.gtimg.com/newsapp_ls/0/13685285688_294195/0" alt="">
    <img class="img" src="https://inews.gtimg.com/newsapp_ls/0/13685285688_294195/0" alt="">
    <img class="img" src="https://inews.gtimg.com/newsapp_ls/0/13685285688_294195/0" alt="">
    <div class="info">
      <span>小兵张嘎</span>
      <span>17评论</span>
      <span>1天前</span>
      <geek-icon name="esay-close"></geek-icon>
    </div>
  </div> -->
  <!-- 单图 -->
  <!-- van-hairline--bottom 下边框  van-multi-ellipsis--l2 两行省略 https://vant-contrib.gitee.io/vant/#/zh-CN/style -->
  <div @click="$router.push(`/article?id=${article.art_id}`)" class="article-item van-hairline--bottom">
    <p class="title van-multi-ellipsis--l2" :class="{w66:article.cover.type===1}">{{article.title}}</p>
    <img v-for="(item,i) in article.cover.images" :key="i" class="img" :src="item" alt="">
    <div class="info">
      <span>{{article.aut_name}}</span>
      <span>{{article.comm_count}} 评论</span>
      <span>{{article.pubdate | relativeTime}}</span>
      <geek-icon name="esay-close"></geek-icon>
    </div>
  </div>
</template>
<script>
export default {
  name: 'ArticleItem',
  props: {
    article: {
      type: Object,
      // 当你传入的是复杂数据类型的时候必须是函数返回值
      default: () => ({})
    }
  }
}
</script>
<style scoped lang="less">
.article-item {
  padding: 15px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .title {
    width: 100%;
    margin: 0;
    line-height: 22px;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
    max-height: 44px;
    &.w66 {
      width: 66%;
    }
  }
  .img {
    width: 112px;
    height: 74px;
    border-radius: 4px;
    margin-bottom: 8px;
  }
  .info {
    width: 100%;
    color: #A5A6AB;
    font-size: 12px;
    position: relative;
    span {
      margin-right: 12px;
    }
    .geek-icon {
      float: right;
      font-size: 14px;
    }
  }
}
</style>
